<template>
    <div>
        <button @click="$emit('getData', '你好')">按钮</button>
        <button @click="onButtonClick">按钮</button>
        <button @click="$emit('setCount')">count++</button>
    </div>
</template>

<script setup>
const emit = defineEmits(['getData', 'setCount']);

function onButtonClick() {
    console.log("触发子组件自己的方法");
    emit('getData', 'hello');
}
</script>

<style scoped></style>